package com.example.tests;

import static org.hamcrest.Matchers.*;
import org.testng.annotations.Test;
import static org.junit.Assert.assertThat;
import com.example.utils.SortedListOf;

public class GroupAdd extends TestBase {
	@Test(dataProvider = "randomValidGroupGenegator")
	public void testGroupAddValiData(GroupData group) throws Exception {
		// save state
		SortedListOf<GroupData> oldList = app.getGroupHelper().getGroups();
		// actions
		app.getGroupHelper().createGroup(group);
		// new state
		SortedListOf<GroupData> newList = app.getGroupHelper().getGroups();
		// compare old vs new
		assertThat(newList, equalTo(oldList.withAdded(group)));

	}
}
